#include"../http/http.hpp"
//大文件传输测试
//创建一个客户端持续给服务器发送数据,直到超时时间看看是否正常,这里我们设置连接超时时间为10s

int main()
{
    Socket cli_sock;
    bool ret = cli_sock.CreateClient(8085,"127.0.0.1");
    if(ret == false)
    {
        ERR_LOG("create newlink error");
        abort();
    }
    cout << "Create Client Success"<< endl;
    string req = "PUT /1234.txt HTTP/1.1\r\nConnection:keep-alive\r\n";
    string body;
    Util::ReadFile("./hello.txt",&body);
    req += "Content-Length:"+ to_string(body.size()) + "\r\n\r\n";
    assert(cli_sock.Send(req.c_str(),req.size())!=-1);
    assert(cli_sock.Send(body.c_str(),body.size())!=-1);
    char buf[1024] = {0};
    assert(cli_sock.Recv(buf,1023));
    DBG_LOG("[%s]",buf);
    sleep(3);
    cli_sock.Close();
}